
# from collections import deque
# import threading
# import time

# class MyInput:
#     instance = None
    
#     def __init__(self) -> None:
#         queue = deque()
#         threading.Thread(target=input_thread, daemon=True).start()

#     def input_thread(self):
#         _input = input
#         while True:
#             queue.append((_input(), time.time()))
#             print("input_thread: ", queue[-1])
        
#     def pop2(self, debounce=0.1):
#         line, t = queue.popleft()
#         result = line
#         if queue and abs(queue[0][1] - t) < debounce:
#             while queue:
#                 result += queue.popleft()[0]
#         return result
        
#     def input(self, timeout=-1):
#         start_time = time.time()
#         while timeout == -1 or time.time() - start_time < timeout:
#             if queue:
#                 return pop2()
#             time.sleep(0.1)
#         return None
    
            
# input = MyInput().input

# while True:
#     text = input().replace("\n","")
    
#     print("main: ", len(text), text)

# # def cached_input():
# #     result, _ = my_input.input()
# #     next_input, _ = my_input.input(0.1)
# #     if next_input:
# #         while next_input:
# #             next_input, _ = my_input.input(0.1)
        
# #     return result

import os
from pathlib import Path
import re
import numpy as np
from functional import seq
os.chdir(Path(__file__).parent)
lcq_text = np.load("lcq" + '.pkl', allow_pickle=True)
lcq_questions = np.array(seq(lcq_text).map(lambda x: x[0]).to_list())
res = (seq(lcq_questions)
        .map(lambda x: re.match(r'^\d+', x))
        .filter(lambda x: x)
        .to_list())

print(len(res), len(lcq_text))